<script setup lang="ts">
import { ref } from 'vue'
import * as test from '../api/test'

defineProps<{ msg: string }>()

const count = ref(0)
// ======================================
const reData = ref("");




function testDemo() {
  test.demo1(count.value).then((rsp)=>{
    console.log("======测试",rsp)
    reData.value = JSON.stringify(rsp);
  })
}
function testDemo1() {
  count.value++
  test.demo1(count.value).then((rsp)=>{
    console.log("======测试",rsp)
    reData.value = JSON.stringify(rsp);
  })
}
</script>

<template>
  <h1>{{ msg }}</h1>

  <div class="card">
    <div>
      <button type="button" @click="count++">点击加一 </button>
      <button type="button" @click="testDemo">点击测试网络 </button>
      <button type="button" @click="testDemo1">点击测试网络 并且加一 </button>
    </div>
    <p>{{ count }}</p>
   <p>测试结果：{{ reData }}</p>
  </div>

  <div class="card">
   
  </div>

  <p>
    Check out
    <a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
      >create-vue</a
    >, the official Vue + Vite starter
  </p>
  <p>
    Learn more about IDE Support for Vue in the
    <a
      href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
      target="_blank"
      >Vue Docs Scaling up Guide</a
    >.
  </p>
  <p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>

<style scoped>
.read-the-docs {
  color: #888;
}
</style>
